<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" name="" id="text1" value="" />
		<select id="sele">
			<option value ="1">+</option>
			<option value ="2">-</option>
			<option value ="3">*</option>
			<option value ="4">/</option>
		</select>
		<input type="text" name="" id="text2" value="" />
		=
		<input type="text" name="" id="text3" value="" />
		<button type="button" onclick="h()">提交</button>
	</body>
	<script type="text/javascript">
		function h(){
			var name=document.getElementById('text1')
			var name1=document.getElementById('text2')
			var name2=document.getElementById('text3')
			var name3=document.getElementById('sele')
			var a=name3.selectedIndex
			
			var x =Number(name.value);
			var y =Number(name1.value);
			
			if (name3[a].value =="1") {
				name2.value=x+y
			} else if(name3[a].value =="2"){
				name2.value=x-y
			}
			else if(name3[a].value =="3"){
				name2.value=x*y
			}
			else if(name3[a].value =="4"){
				name2.value=x/y
			}
		}
		
	</script>
</html>
